package com.suneast.suneaststore.ui.customview;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.suneast.suneaststore.R;

public class FastOrderStatusView extends ConstraintLayout {

    private int status = 0;

    public FastOrderStatusView(Context context) {
        super(context);
        initView(context);
    }

    public FastOrderStatusView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FastOrderStatusView);
        status = typedArray.getInt(R.styleable.FastOrderStatusView_status, 0);
        typedArray.recycle();
        initView(context);
    }

    public FastOrderStatusView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        LayoutInflater.from(context).inflate(R.layout.layout_fast_order_status, this, true);
        switch (status) {
            case 0: {
                TextView stepOneTv = findViewById(R.id.tv_step_one);
                View spiltOneTv = findViewById(R.id.spiltview_one);
                stepOneTv.setSelected(true);
                spiltOneTv.setSelected(true);
            }
            break;
            case 1: {
                TextView stepTwoTv = findViewById(R.id.tv_step_two);
                View spiltTwoTv = findViewById(R.id.spiltview_two);
                stepTwoTv.setSelected(true);
                spiltTwoTv.setSelected(true);
            }
            break;
            case 2: {
                TextView stepThreeTv = findViewById(R.id.tv_step_three);
                stepThreeTv.setSelected(true);
            }
            break;
        }
    }

    public void setStatus() {

    }
}
